package com.yurun.orgbranch.mapper;

import com.yurun.commonapi.pojo.Branch;
import com.yurun.commonapi.pojo.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;

import java.math.BigInteger;
import java.util.Date;
import java.util.List;

/**
 * @author lihao
 * @mail lihaohaocn@gmail.com
 * @Date 2021/8/18 11:03 下午
 */
@Mapper
@Repository
public interface BranchMapper {

    List<Branch> getAllBranch();

    List<Branch> getBranchByName(@Param("branchName") String branchName, @Param("employeeId") BigInteger employeeId);

    List<Branch> getBranchOption(BigInteger organizationId);

    List<Branch> getAllBranchInfoByOrgId(BigInteger employeeId);

    int delBranchById(Branch branch);

    int addBranch(Branch branch);

    BigInteger getBranchCount(BigInteger organizationId);

    int editBranchCount(@Param("organizationId") BigInteger organizationId, @Param("branchCount") BigInteger branchCount);

    int editBranch(Branch branch);

    Branch getBranchInfoById(@Param("organizationId") BigInteger organizationId, @Param("branchId") BigInteger branchId);

    BigInteger verifyBranchIdIsRepeat(BigInteger branchId);

    int delBranchByBranchId(@Param("organizationId") BigInteger organizationId, @Param("time") Date time, @Param("branchId") BigInteger branchId);

    int delEmployeeByOrgId(@Param("organizationId") BigInteger organizationId, @Param("time") Date time, @Param("branchId") BigInteger branchId);

    int delTeacherByOrgId(@Param("organizationId") BigInteger organizationId, @Param("time") Date time, @Param("branchId") BigInteger branchId);

    int delStudentByOrgId(@Param("organizationId") BigInteger organizationId, @Param("time") Date time, @Param("branchId") BigInteger branchId);

    List<Integer>  getPermissionByRole(int roleId);

    List<Integer> getAdminAllPermission(int categoryId);

    int getRoleIdByOrgIdAndRoleName(@Param("organizationId") BigInteger organizationId, @Param("name") String name);
}
